package com.example.flowabledemo.listener;

import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;

/**
 * @ClassName: WorkListener
 * @Description:
 * @Date 2024/05/11 09:55
 * @Author songshaoqiu
 **/
@Component
public class WorkListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        System.out.println("WorkListener 执行了===>"+delegateTask.getEventName());
        String eventName = delegateTask.getEventName();
        switch (eventName){
            case EVENTNAME_CREATE:
                delegateTask.setAssignee("张飞");
                break;
            case EVENTNAME_ASSIGNMENT:
                System.out.println("assigneement执行");
                break;
            case EVENTNAME_COMPLETE:
                System.out.println("任务结束");
                break;
            case EVENTNAME_DELETE:
                System.out.println("delete 执行");
                break;
        }

    }
}
